Refactor discrete_mechanisms to Select-Measure-Estimate base class#89
Open
copybara-service[bot] wants to merge 1 commit into
Open
Refactor discrete_mechanisms to Select-Measure-Estimate base class#89copybara-service[bot] wants to merge 1 commit into
copybara-service[bot] wants to merge 1 commit into
Conversation
8d25fe3 to
f42e2e7
Compare
Introduce a `DiscreteMechanism` base class in base.py that implements the Select-Measure-Estimate paradigm from McKenna et al. (2021). Each step of the pipeline is a separate overridable method, enabling code reuse across mechanisms that differ primarily in the *select* step. New abstractions: - `DiscreteMechanism`: Base dataclass with `configure()` for budget setup. `__call__` owns the fixed pre/post scaffolding (measure one-way, compress, generate, package result); `_run` is the overridable middle where the estimation strategy lives. One-shot mechanisms override only `_select`; adaptive mechanisms override `_run`. - `GaussianMarginalMeasurement`: A `DPMechanism` that encapsulates Gaussian noise addition to marginal queries with proper `dp_event`. - `_one_way_cliques` hook: Subclasses can restrict which one-way marginals are measured (AIM/AIM-GDP use workload-specific columns). Mechanism migrations: - Independent: one_way_budget_fraction=1.0, _select -> [], delegates dp_event - Direct: one_way_budget_fraction=0.0, _select -> prespecified queries - MST: _select delegates to existing exponential mechanism helper - AIM: Overrides _run for the adaptive annealed loop, reuses building blocks - AIM-GDP: Same _run pattern as AIM but in GDP budget space - SWIFT: Overrides _select, _precompile, _measure, _estimate, _generate for per-clique budget allocation and junction tree precompilation PiperOrigin-RevId: 944103007
f42e2e7 to
f7399e7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refactor discrete_mechanisms to Select-Measure-Estimate base class
Introduce a
DiscreteMechanismbase class in base.py that implements theSelect-Measure-Estimate paradigm from McKenna et al. (2021). Each step of
the pipeline is a separate overridable method, enabling code reuse across
mechanisms that differ primarily in the select step.
New abstractions:
DiscreteMechanism: Base dataclass withconfigure()for budget setup.__call__owns the fixed pre/post scaffolding (measure one-way, compress,generate, package result);
_runis the overridable middle where theestimation strategy lives. One-shot mechanisms override only
_select;adaptive mechanisms override
_run.GaussianMarginalMeasurement: ADPMechanismthat encapsulatesGaussian noise addition to marginal queries with proper
dp_event._one_way_cliqueshook: Subclasses can restrict which one-waymarginals are measured (AIM/AIM-GDP use workload-specific columns).
Mechanism migrations:
for per-clique budget allocation and junction tree precompilation